home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / pistol.zip / PISTOL.H < prev    next >
Text File  |  1987-08-20  |  4KB  |  177 lines

  1. /*********************************************************/
  2. /*                             */
  3. /* PISTOL-Portably Implemented Stack Oriented Language     */
  4. /*            Version 1.3             */
  5. /* (C) 1982 by    Ernest E. Bergmann             */
  6. /*        Physics, Building #16             */
  7. /*        Lehigh Univerisity             */
  8. /*        Bethlehem, Pa. 18015             */
  9. /*                             */
  10. /* Permission is hereby granted for all reproduction and */
  11. /* distribution of this material provided this notice is */
  12. /* is included.                         */
  13. /*                             */
  14. /*********************************************************/
  15. /* February 24, 1982 */
  16.  
  17. #define VERSION        13
  18. #define    RAMSIZE        4000
  19. #define COMPBUF        RAMSIZE-250
  20. #define STRINGSSIZE    5196    /* chosen to even out blocks */
  21. #define NSAVE        104    /* used by coredump&restore */
  22. #define LINEBUF        2800
  23. #define NFUNCS        75
  24. #define    W        2
  25.  
  26. #define    SSIZE        200
  27. #define LSIZE        30
  28. #define CSIZE        30
  29. #define    RSIZE        30
  30. #define    VBASE        1
  31. #define VSIZE        8
  32. #define CHKLMT        20
  33. #define MAXORD        128
  34. #define    MAXINT        32767
  35. #define MAXLINNO    300
  36. #define NAMESIZE    20
  37.  
  38. #define    FALS        0
  39. #define TRU        -1
  40. #define NEWLINE        13
  41.  
  42. #define TERMWIDTH    64
  43. #define TERMLENGTH    20
  44.  
  45. #define PSEMICOLON    0
  46. #define WSTORE        1
  47. #define TIMES        2
  48. #define    PLUS        3
  49. #define    SUBTRACT    4
  50. #define    DIVMOD        5
  51. #define PIF        6
  52. #define WAT        7
  53. #define ABRT        8
  54. #define SP        9
  55. #define LOAD        10
  56. #define    PELSE        11
  57. #define WRD        12
  58. #define RP        13
  59. #define DROPOP        14
  60. #define PUSER        15
  61. #define EXEC        16
  62. #define EXITOP        17
  63. #define LIT        18
  64. #define STRLIT        19
  65. #define RPOP        20
  66. #define SWP        21
  67. #define TYI        22
  68. #define TYO        23
  69. #define RPSH        24
  70. #define SEMICF        25
  71. #define RAT        26
  72. #define COMPME        27
  73. #define COMPHERE    28
  74. #define DOLLARC        29
  75. #define COLON        30
  76. #define SEMICOLON    31
  77. #define IFOP        32
  78. #define ELSEOP        33
  79. #define THENOP        34
  80. #define DOOP        35
  81. #define LOOPOP        36
  82. #define BEGINOP        37
  83. #define ENDOP        38
  84. #define REPET        39
  85. #define PERCENT        40
  86. #define PDOLLAR        41
  87. #define PCOLON        42
  88. #define CASAT        43
  89. #define PDOOP        44
  90. #define PPLOOP        45
  91. #define PLLOOP        46
  92. #define CAT        47
  93. #define CSTORE        48
  94. #define PLOOP        49
  95. #define GT        50
  96. #define SEMIDOL        51
  97. #define KRNQ        52
  98. #define SAT        55
  99. #define FINDOP        56
  100. #define LISTFIL        57
  101. #define LAT        59
  102. #define OFCAS        60
  103. #define CCOLON        61
  104. #define SEMICC        62
  105. #define NDCAS        63
  106. #define POFCAS        64
  107. #define PCCOL        65
  108. #define PSEMICC        66
  109. #define GTLIN        67
  110. #define WORD        68
  111. #define OPENR        69
  112. #define OPENW        70
  113. #define READL        71
  114. #define WRITL        72
  115. #define CORDMP        73
  116. #define RESTOR        74
  117.  
  118. union word
  119.     {int in;
  120.     unsigned un;
  121.     char *pc;
  122.     union word *pw;
  123.     };
  124. int    ip;    /* but can be used for machine addresses */
  125. unsigned instr;
  126. int    temp;
  127. int    savlevel,savinstr;    /*for trace in interpret();*/
  128.  
  129. int    stkptr;
  130. int    rptr;
  131. int    lptr;
  132. int    cptr;
  133.  
  134. int    *Pw,*Pw2;    /* needed for pointer conversions */
  135. char    *Pc,*Pc2;    /* needed for pointer conversions */
  136.  
  137. int    (*farray[NFUNCS])(); /* to hold pointers to interpreted
  138.                 primitive functions */
  139. int    mstack[3];    /* extra padding */
  140. int    stack[SSIZE];
  141. int    pstack[3];    /* extra padding */
  142. int    lstack[LSIZE];
  143. int    rstack[RSIZE];
  144. int    cstack[CSIZE];
  145.  
  146. char    imagename[NAMESIZE];    /*name[0]=length*/
  147. char    namein[NAMESIZE];    /*name[length+1]=0*/
  148. char    namout[NAMESIZE];
  149. char    infil1[NAMESIZE];
  150. char    listname[NAMESIZE];
  151. char    c;
  152. char    nullname;
  153.  
  154. char    *feof;
  155. char    *nopen;
  156. char    *id;
  157. char    *synt;
  158. char    *ovflo;
  159. char    *undflo;
  160. char    *redef;
  161. char    *divby0;
  162.  
  163. int    addr;
  164. int    val;
  165. int    i,j;
  166.  
  167. union word nram[58];    /* space for negative args for ram */
  168. union word ram[RAMSIZE];
  169. char    strings[STRINGSSIZE];
  170.  
  171. char ldfil1[BUFSIZ],list[BUFSIZ],edin[BUFSIZ],
  172.     edout[BUFSIZ];
  173. /*"static variables" for vfind,pstrcmp*/
  174. int *vloc;
  175. char vmatch;
  176. char pcount,*Pc3;
  177.  in inter